var util = require('../../../utils/util.js');
var ajax = require('../../../utils/ajax.js');
var common = require('../../../utils/common.js');
var PageBase = require('../../../common/PageBase.js');
var Pagination = require('../../../utils/pagination.js');
var app = getApp();

Page(common.extendPage(PageBase, {
    data: {
        dataLoaded: false,
        orderList: []
    },

    onLoad: function(options) {
        var sid = '';
        if (typeof (options.scene) != "undefined" && options.scene != '') {
          var scene = decodeURIComponent(options.scene);
          sid = scene;
        }
        else{
          sid = app.getEmployeeSid();
        }
        common.initApp({
            loginSuc: () => {
              this._getOrderList(sid);
            }
        });
    },

    onPullDownRefresh() {
    },

    onReachBottom() {
    },

    /**
     * 获取订单列表
     */
    _getOrderList: function(sid) {

        ajax.G({
          url: 'm=store&c=order',
          data: {
            sid
          },
          success: (res) => {
            //debugger;
            var orders = res.data;
            this.setData({
              dataLoaded: true,
              orderList: orders
            });


          }
        });

    },

}));